package tw.singleton;

import tw.singleton.SingleObject.HungrySingle;

public class SingletonPatternDemo {
    public static void main(String[] args) {
        //不合法的构造函数
        //编译时错误：构造函数 HungrySingle() 是不可见的
        //HungrySingle object = new HungrySingle();

        //获取唯一可用的对象
        HungrySingle object = HungrySingle.getInstance();
        //显示消息
        object.showMessage();
    }
}